
function setHeight(el, binding) {
  // 获取当前元素距离顶部的高度
  var distanceToTop = el.getBoundingClientRect().top;
  const viewportHeight = window.innerHeight;
  // 计算除最大可设置高度
  const maxHeight = viewportHeight - distanceToTop - (binding.value || 0);

  el.style.height = maxHeight + 'px';
  el.style.overflowY = 'auto';
  el.style.overflowX = 'hidden';
}
export default {
  inserted(el, binding) {
    setHeight(el, binding);
  },
  unbind(el) {
  }
};